package com.niiwoo.civet.trade.dao.mapper;

import com.niiwoo.civet.trade.dao.entity.InvestorCreditor;
import com.niiwoo.civet.trade.dto.request.creditor.TradableInvestOrderRequestDTO;
import com.niiwoo.civet.trade.dto.response.creditor.TradableInvestOrderDTO;
import com.niiwoo.civet.trade.dto.response.creditor.TradableInvestOrderStatDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface InvestorCreditorMapperExt extends InvestorCreditorMapper {

    /**
     * 获取指定用户名下所有可债转的投资订单
     * @param request
     * @return
     */
	List<TradableInvestOrderDTO> getAllTradableInvestOrdersByPage(TradableInvestOrderRequestDTO request);
	
	List<TradableInvestOrderStatDTO> getAllTradableInvestorCreditor(TradableInvestOrderRequestDTO request);
	
	List<TradableInvestOrderDTO> investOrderTradableValidate(TradableInvestOrderRequestDTO request);

	/**
	 * 统计指定用户可债转投资订单总金额和数量
	 * @param request
	 * @return
	 */
	TradableInvestOrderStatDTO getTradableInvestOrderStat(TradableInvestOrderRequestDTO request);

	/**
	 * 获取指定投资订单的债转信息
	 * @param request
	 * @return
	 */
	TradableInvestOrderDTO getTradableInvestOrder(TradableInvestOrderRequestDTO request);


	InvestorCreditor queryInvestorCreditorByInvestOrderId(Long investOrderId);

	List<InvestorCreditor> selectByInvestOrderIdsForUpdate(@Param("investOrderIds") Set<Long> investOrderIds);

	List<InvestorCreditor> selectByInvestOrderIds(@Param("investOrderIds") Set<Long> investOrderIds);


	List<InvestorCreditor> selectByInvestOrderIdsByProjectId(@Param("projectId") Long projectId);

	InvestorCreditor selectByInvestUserIdAndInvestOrderId(@Param("investUserId") String investUserId, @Param("investOrderId") Long investOrderId);
	
	InvestorCreditor selectByInvestOrderIdForUpdate(@Param("investOrderId") Long investOrderId);
	
	InvestorCreditor selectByInvestOrderId(@Param("investOrderId") Long investOrderId);

	/**
	 * 根据当前用户可债转债权获取期限筛选列表
	 * @param userId
	 * @return
	 */
	List<Integer> findUserTradableInvestOrderActivePriod(TradableInvestOrderRequestDTO request);

	/**
	 * 批量查询投资人债权表
	 * @param investOrderIds 订单ID
	 * @return lsit
	 */
	List<InvestorCreditor> queryInvestorCreditorByInvestOrderIdList(@Param("investOrderIds")Set<Long> investOrderIds);

}